package com.example.idea.mapper;

import com.example.idea.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrdersMapper {


    void add(Orders orders);

    void update(Orders orders);

    void delete(Integer id);

    Orders query(Integer id);

    void deleteBatch(String ids);

    List<Orders> list();

    List<Orders> selectList(Orders orders);

    @Select("select * from orders where category like concat('%',#{category},'%') and name like concat('%',#{name},'%') ORDER BY id DESC limit #{skipNum}, #{pageSize} ")
    List<Orders> selectByPage(Integer skipNum, Integer pageSize, String category, String name);

    @Select("select count(*) from orders where category like concat('%',#{category},'%') and name like concat('%',#{name},'%')")
    Integer selectCountByPage(String category, String name);
}
